import {createRouter, createWebHashHistory} from 'vue-router'


const router = createRouter({
    history: createWebHashHistory(),

    routes: [
        //一级路由
        {

            path: '/test1',
            component: () => import('../components/test1.vue'),
        },{
            path: '/test2',
            component: () => import('../components/test2.vue'),
        },{
            path: '/test3',
            component: () => import('../components/test3.vue'),
        },{
            path: '/test4',
            component: () => import('../components/test4.vue'),
        },{
            path: '/test5',
            component: () => import('../components/test5.vue'),
        },{
            path: '/test6',
            component: () => import('../components/test6.vue'),
        },{
            path: '/test7',
            component: () => import('../components/test7.vue'),
        },{
            path: '/test8',
            component: () => import('../components/test8.vue'),
        },{
            path: '/test9',
            component: () => import('../components/test9.vue'),
        },{
            path: '/test10',
            component: () => import('../components/test10.vue'),
        },{
            path: '/test11',
            component: () => import('../components/test11.vue'),
        },{
            path: '/test12',
            component: () => import('../components/test12.vue'),
        },{
            path: '/test13',
            component: () => import('../components/test13.vue'),
        },{
            path: '/test14',
            component: () => import('../components/test14.vue'),
        },{
            path: '/test15',
            component: () => import('../components/test15.vue'),
        },{
            path: '/test16',
            component: () => import('../components/test16.vue'),
        },{
            path: '/test17',
            component: () => import('../components/test17.vue'),
        },{
            path: '/test18',
            component: () => import('../components/test18.vue'),
        },{
            path: '/test19',
            component: () => import('../components/test19.vue'),
        },{
            path: '/test20',
            component: () => import('../components/test20.vue'),
        },{
            path: '/test21',
            component: () => import('../components/test21.vue'),
        },{
            path: '/test22',
            component: () => import('../components/test22.vue'),
        },{
            path: '/test23',
            component: () => import('../components/test23.vue'),
        },{
            path: '/test25',
            component: () => import('../components/test25.vue'),
        },{
            path: '/a1',
            component: () => import('../components/test2/a1.vue'),
        },{
            path: '/a2',
            component: () => import('../components/test2/a2.vue'),
        },
        {
            // 子订单
            path: '/',
            redirect: '/a2',
        }

    ]
})

router.beforeEach((to, from, next) => {
    if (to.meta.title) {
        document.title = to.meta.title
    }
    next()
})

export default router